﻿using System;

namespace GFXHelper
{
    public static class ExtensionMethods
    {
        /// <summary>
        /// Wandelt einen Integer32-Wert in einen Booleschen Wert um.
        /// </summary>
        /// <param name="currentInt">Der Integer32-Wert.</param>
        /// <returns>Einen Booelan-Wert.</returns>
        public static bool ToBool(this int currentInt)
        {
            if (currentInt == 1)
                return true;
            else
                return false;
        }

        /// <summary>
        /// Zählt die Werte im Integer32-Array zusammen.
        /// </summary>
        /// <param name="currentArray">Das Integer32-Array.</param>
        /// <returns>Gibt die Summe aller Werte im Integer32-Array zurück.</returns>
        public static int CountNumbers(this int[] currentArray)
        {
            int result = 0;
            for (int i = 0; i < currentArray.Length; i++)
            {
                result += currentArray[i];
            }
            return result;
        }
    }
}
